package bomberman.runable;

import bomberman.model.Boom;
import bomberman.util.Constants;

/**
 * 爆炸效果变化线程，控制爆炸效果大小变化
 * @author EX-FUHUICHAO001
 * 2016-9-26 14:09:34
 */
public class MyRunableBoomChange implements Runnable {

	private Boom boom;
	
	public MyRunableBoomChange(Boom boom){
		this.boom = boom;
	}
	
	public void run() {
		try {
			// 若爆炸效果未消失，则持续变小
			while(!boom.isLive()){
				Thread.sleep(Constants.BOOM_CHANGE_SLEEP_TIME);
				switch (boom.getSize()) {
					case Constants.BOOM_SIZE_BIG:
						boom.setSize(Constants.BOOM_SIZE_MIDDLE);
						break;
					case Constants.BOOM_SIZE_MIDDLE:
						boom.setSize(Constants.BOOM_SIZE_SMALL);
						break;
					default:
						break;
				}
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public Boom getBoom() {
		return boom;
	}

	public void setBoom(Boom boom) {
		this.boom = boom;
	}

	
}
